/*******************************************************************************
 *
 *    Copyright (c) Baina Info Tech Co. Ltd
 *
 *    Test_VoiceControl
 *    
 *    RingtoneControl
 *    TODO File description or class description.
 *
 *    @author: zuochen
 *    @since:  2011-6-17
 *    @version: 1.0
 *
 ******************************************************************************/

package com.phone.voice.control;

import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;

/**
 * RingtoneControl of Test_VoiceControl.
 * 
 * @author zuochen
 * 
 */

public class RingtoneControl implements VoiceControl {
	private final AudioManager mAudioManager;

	public RingtoneControl(Context mContext) {
		mAudioManager = (AudioManager) mContext
				.getSystemService(Activity.AUDIO_SERVICE);
	}

	@Override
	public int getMaxVolume() {
		return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
	}

	@Override
	public int getCurrentVolume() {
		return mAudioManager.getStreamVolume(AudioManager.STREAM_RING);
	}

	@Override
	public void setVolume(int volume) {
		mAudioManager.setStreamVolume(AudioManager.STREAM_RING, volume,
				AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
	}

}
